package com.ccp.dev.qbdms.dao;

import com.ccp.dev.core.basic.base.IBaseMapper;
import com.ccp.dev.qbdms.model.WQbdMyKnowledge;
import com.ccp.dev.qbdms.model.WQbdSoftwareproAnls;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 我的知识 信息数据库操作类
 *
 * @author hw
 * @date 2020-07-27 10:56:30
 */
@Mapper
public interface WQbdMyKnowledgeDao extends IBaseMapper<WQbdMyKnowledge,String> {

    List<WQbdMyKnowledge> queryAll(QueryFilter queryFilter);

    @Select("select * from w_qbd_my_knowledge where knowledge_classifica=#{knowledge_classifica} and user_id=#{userId}")
    WQbdMyKnowledge findByUserIdAndknowClassId(@Param(value = "knowledge_classifica") String knowledge_classifica, @Param(value = "userId") String userId);

    @Delete("delete from w_qbd_my_knowledge where knowledge_classifica=#{knowledge_classifica} and user_id=#{userId} ")
    int delByUserIdAndDicId(@Param(value = "knowledge_classifica")String knowledge_classifica, @Param(value = "userId")String userId);

    @Select("select * from w_qbd_my_knowledge where  user_id=#{userId} order by updateTime desc")
    List<WQbdMyKnowledge> findByUserId(@Param(value = "userId")String user_id);

    WQbdSoftwareproAnls getParentAndChilden(String id);
}
